﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kokomo.Mirror.Ia32
{
	public abstract class Ia32DisassemblyBase
	{
		internal Ia32DisassemblyBase(
			long baseAddress,
			int length
			)
		{
			this.BaseAddress = baseAddress;
			this.Length = length;
		}

		public long BaseAddress { get; private set; }
		public int Length { get; private set; }

		public abstract bool ContainsAddress(long address);

		public abstract IEnumerable<Ia32Instruction> Instructions { get; }
		public Ia32Instruction InstructionAt(long address)
		{
			Ia32Instruction instruction = this.Instructions.FirstOrDefault(i => i.Offset == address);
			return instruction;
		}
	}
}
